﻿using System;
using CuteSprite.Eme.UI.Utils;
using HmFramework.Components;

namespace CuteSprite.Eme.UI.Settlement
{
	public partial class FrmBsdSettlementAdmin : EmeCommonAdminForm
	{
		#region -- 属性 --

		#endregion -- 属性 --

		#region -- 构造 --

		/// <summary>默认构造函数</summary>
		public FrmBsdSettlementAdmin()
		{
			EntityDataSource = BsdEntityHelper.ModelSettlement;
			EntityDataTable = BsdEntityHelper.SSTableSettlement;

			//this.ShowDialog(this);
			InitForm();
		}

		#endregion -- 构造 --

		#region -- 控件初始化 --

		private ButtonX btnBatCreatSettlement;

		protected override void InitComponent()
		{
			base.InitComponent();

			btnBatCreatSettlement = CreateButton("btnBatchUpdateOP", "批量生成结算记录", 8);
			btnBatCreatSettlement.Location = new System.Drawing.Point(431, 7);
			btnBatCreatSettlement.Click += new EventHandler(btnBatCreatSettlement_Click);
			btnBatCreatSettlement.Size = new System.Drawing.Size(120, 23);
			ToolbarPanelControl.Controls.Add(btnBatCreatSettlement);
		}

		#endregion -- 控件初始化 --

		#region -- 权限项匹配 --

		/// <summary>已重载，操作权限项匹配</summary>
		protected override void MatchPermissionItems()
		{
			base.MatchPermissionItems();

			btnBatCreatSettlement.Visible = ServerManagement.IsAuthorized(PermissionItemSetsCode, "BatchGenerateSettlement") && CurrentModelViewIsEffective;
		}

		#endregion

		#region -- 批量生成结算记录 --

		private void btnBatCreatSettlement_Click(object sender, EventArgs e)
		{
			var frm = FrmBsdSettlementBatch.Create();
			var result = frm.ShowDialog(this);
			frm.Close();
		}

		#endregion -- 管理计价方案 --
	}
}